package com.dao.qsl;

import com.bean.qsl.HdInfo;
import com.util.qsl.Dbutil;
import org.springframework.stereotype.Repository;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

@Repository
public class HdXxSs {
      public   List<HdInfo> ss(String  hdmc){
	  Dbutil d=new Dbutil();
	  Connection c=null;

	  List<HdInfo>  list =new ArrayList<>();
	  try {
	        c=d.getConnection();
	        String sql="SELECT * from village v,community c where v.vid=c.vid and  cname=?";
	        PreparedStatement pr=c.prepareStatement(sql);
	        pr.setString(1,hdmc);

	        ResultSet rs=pr.executeQuery();

	        while (rs.next()){
		    HdInfo h=new HdInfo();
		    h.setHdxh(rs.getInt("cid"));
		    h.setHdmc(rs.getString("cname"));
		    h.setKsj(rs.getString("startDate"));
		    h.setJssj(rs.getString("endDate"));
		    h.setZt(rs.getString("zt"));
		    h.setXqmc(rs.getString("vname"));
		    list.add(h);
	        }
	  }catch (Exception e){
	        e.printStackTrace();
	  }
	  return list;
      }
}
